module.exports = options => {
  return async (ctx, next) => {
    let { _limit, _page, _desc, _asc } = ctx.query
    ctx.state.page = {
      _limit: _limit ? Math.floor(Number(_limit)) || 10 : 10,
      _page: _page ? Math.floor(Math.floor(Number(_page))) || 1 : 1,
    }
    await next()
  }
}